import axios from "axios";
// import { config } from "vue/types/umd";
// import { config } from "vue/types/umd";

function ajax(options) {
    return new Promise((resolve, reject) => {
        const axiosIntance = axios.create({
            baseURL: "https://api.muxiaoguo.cn",
            timeout: "60000"
        })

        axiosIntance.interceptors.request.use(config => {
            console.log('请求前');
            // config.params.name = 'gong';
            return config
        })

        axiosIntance.interceptors.response.use(res => {
            console.log('请求后');
            console.log(res);
            return res.data
        })

        axiosIntance(options).then(res => {
            resolve(res)
        }).catch(err => {
            reject(err)
        })
    })
}

export default ajax